package com.sise.parkinglot.controller.applet;


import com.sise.parkinglot.bean.CodeMsg;
import com.sise.parkinglot.entity.User;
import com.sise.parkinglot.service.IUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author ZJ
 */
@RestController
@RequestMapping("/api/user")
public class AppletUserController {

    @Resource
    private IUserService userService;

    @PostMapping("/upUser")
    public CodeMsg<String> upUser(@RequestBody Map<String, Object> map){
        return userService.upUser(map);
    }

    @PostMapping("/getToken")
    public CodeMsg<String> getToken(@RequestBody Map<String, Object> map){
        return userService.getToken(map);
    }

    @PostMapping("/updateUserByToken")
    public CodeMsg<String> updateUserByToken(@RequestBody Map<String, String> map){
        return userService.updateUserByToken(map);
    }

    @PostMapping("/getOverage")
    public CodeMsg<String> getOverage(@RequestBody Map<String, String> map){
        return userService.getOverage(map);
    }

    @PostMapping("/addOverage")
    public CodeMsg<String> addOverage(@RequestBody Map<String, String> map){
        return userService.addOverage(map);
    }

    @PostMapping("/updateToken")
    public CodeMsg<String> updateToken(@RequestBody Map<String, String> map){
        return userService.updateToken(map);
    }

    @PostMapping("/getUserInfoByToken")
    public CodeMsg<User> getUserInfoByToken(@RequestBody Map<String, String> map){
        return userService.getUserInfoByToken(map);
    }

    @PostMapping("/pay")
    public CodeMsg<String> pay(@RequestBody Map<String, String> map){
        return userService.pay(map);
    }

    @PostMapping("/updatePassword")
    public CodeMsg<String> updatePassword(@RequestBody Map<String, String> map){
        return userService.updatePassword(map);
    }
}
